package com.cn.wkditui;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

/**
 * 
 * @author shang 单例 用来存储 账户（jxt—�?�id 用来登陆 �? 密码 登陆�? phpsession
 * 
 */
public class MyPreference {

	private SharedPreferences sharedPreference;
	private static Context mcontext;

	private String packageName = "";
	private static final String USER_ID = "UserId"; // 登录�?
	private static final String PROVICE = "provice"; // 登录�?
	private static final String CITY = "city"; // 登录�?
	private static final String TOKEN = "token"; // 登录�?
	private static final String VENDORID = "vendorId"; // 登录�?
	private static final String STAFFID = "staffID"; // 登录�?
	private static class InstanceHolder {

		private final static MyPreference preference = new MyPreference();

	}

	// 饿汉�? 创建�?个单�?
	public static MyPreference getInstance(Context context) {
		mcontext = context;
		return InstanceHolder.preference;
	}

	/**
	 * 私有化构造函�?
	 * 
	 * @param
	 */
	private MyPreference() {

		packageName = mcontext.getPackageName() + "_preferences";
		sharedPreference = mcontext.getSharedPreferences(packageName,
				mcontext.MODE_PRIVATE);
	}

	//	public String getUser_Id() {
	//		String loginName = sharedPreference.getString(USER_ID, "");
	//		return loginName;
	//	}

	public String getToken() {
		String token = sharedPreference.getString(TOKEN, null);
		return token;
	}

	public void setToken(String token) {
		Editor editor = sharedPreference.edit();
		editor.putString(TOKEN,token);
		editor.commit();

	}
	public String getStaffid() {
		String staffid = sharedPreference.getString(STAFFID, null);
		return staffid;
	}

	public void setStaffid(String staffid) {
		Editor editor = sharedPreference.edit();
		editor.putString(STAFFID,staffid);
		editor.commit();

	}

	public String getUser_Id() {
		String userid = sharedPreference.getString(USER_ID, null);

		return userid;
	}

	public void setUser_Id(String userid) {
		Editor editor = sharedPreference.edit();
		editor.putString(USER_ID,userid);
		editor.commit();

	}
	public String getCity() {
		String city = sharedPreference.getString(CITY, null);

		return city;
	}

	public void setCity (String city) {
		Editor editor = sharedPreference.edit();
		editor.putString(CITY,city);
		editor.commit();

	}

	public String getVendorid() {
		String vendorid = sharedPreference.getString(VENDORID, null);

		return vendorid;
	}

	public void setVendorid (String vendorid) {
		Editor editor = sharedPreference.edit();
		editor.putString(VENDORID,vendorid);
		editor.commit();

	}

	public String getProvice() {
		String provice = sharedPreference.getString(PROVICE, null);

		return provice;
	}

	public void setProvice(String provice) {
		Editor editor = sharedPreference.edit();
		editor.putString(PROVICE,provice);
		editor.commit();

	}



	//	public boolean getIsSaveSsmm() {
	//		boolean ssmm = sharedPreference.getBoolean(IS_SAVE_SSMM, false);
	//		return ssmm;
	//	}
	//
	//	public void setIsSaveSsmm(boolean ssmm) {
	//		Editor editor = sharedPreference.edit();
	//		editor.putBoolean(IS_SAVE_SSMM, ssmm);
	//		editor.commit();
	//
	//	}
	//
	//	public boolean getWfcxMm() {
	//		boolean wfcxMm = sharedPreference.getBoolean(WFCX_MM, true);
	//		return wfcxMm;
	//	}
	//
	//	public void setWfcxMm(boolean ssmm) {
	//		Editor editor = sharedPreference.edit();
	//		editor.putBoolean(WFCX_MM, ssmm);
	//		editor.commit();
	//
	//	}
	//
	//	public boolean getClxxMm() {
	//		boolean clxxMm = sharedPreference.getBoolean(CLXX_MM, true);
	//		return clxxMm;
	//	}
	//
	//	public void setClxxMm(boolean ssmm) {
	//		Editor editor = sharedPreference.edit();
	//		editor.putBoolean(CLXX_MM, ssmm);
	//		editor.commit();
	//
	//	}
	//
	//	public boolean getJzxxMm() {
	//		boolean jzxxMm = sharedPreference.getBoolean(JZXX_MM, true);
	//		return jzxxMm;
	//	}
	//
	//	public void setJzxxMm(boolean ssmm) {
	//		Editor editor = sharedPreference.edit();
	//		editor.putBoolean(JZXX_MM, ssmm);
	//		editor.commit();
	//
	//	}
	//
	//	public boolean getJfjlMm() {
	//		boolean jfjlMm = sharedPreference.getBoolean(JFJL_MM, true);
	//		return jfjlMm;
	//	}
	//
	//	public void setJfjlMm(boolean ssmm) {
	//		Editor editor = sharedPreference.edit();
	//		editor.putBoolean(JFJL_MM, ssmm);
	//		editor.commit();
	//
	//	}
	//	public boolean getNeedMm() {
	//		boolean jfjlMm = sharedPreference.getBoolean(NEED_MM, true);
	//		return jfjlMm;
	//	}
	//
	//	public void setNeedMm(boolean ssmm) {
	//		Editor editor = sharedPreference.edit();
	//		editor.putBoolean(NEED_MM, ssmm);
	//		editor.commit();
	//
	//	}
	/*
	 * public boolean IsSavePwd(){ Boolean isSavePwd =
	 * sharedPreference.getBoolean(IS_SAVE_PWD, false); return isSavePwd; }
	 * 
	 * 
	 * public void SetIsSavePwd(Boolean isSave){ Editor edit =
	 * sharedPreference.edit(); edit.putBoolean(IS_SAVE_PWD, isSave);
	 * edit.commit(); }
	 */

}
















